<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>javascript 阶段</title>
    <style>
        div {
            width: 100px;
            height: 100px;
            background-color: red;
            border: 1px solid white;
        }
    </style>
</head>

<body>


    <script>
        var str = "";
        function template() {
            str += "<div></div>";
        }
        template();
        template();
        template();
        template();

        document.write(str);
    </script>
</body>

</html>